import Vue from 'vue'
import VueRouter from "vue-router";

import home from "@/views/layout/Index.vue";
import welcome from "@/views/welcome/Index.vue";

const about = () => import("@/views/about/Index.vue");
const station = () => import("@/views/system/station/Index.vue");
const train = () => import("@/views/system/train/Index.vue");
const trainStation = () => import("@/views/system/trainstation/Index.vue");
const trainCarriage = () => import("@/views/system/carriage/Index.vue");
const trainSeat = () => import("@/views/system/seat/Index.vue");
const job = () => import("@/views/batch/job/Index.vue");
const dailyTrain = () => import("@/views/daily/train/Index.vue");
const dailyTrainStation = () => import("@/views/daily/station/Index.vue");
const dailyTrainCarriage = () => import("@/views/daily/carriage/Index.vue");
const dailyTrainSeat = () => import("@/views/daily/seat/Index.vue");
const dailyTrainTicket = () => import("@/views/daily/ticket/Index.vue");
const orderConfirm = () => import("@/views/order/Index.vue");
const ticket = () => import("@/views/ticket/Index.vue");
const dailyTrainToken = () => import("@/views/daily/token/Index.vue");

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: home,
    redirect: "/welcome",
    children: [
      {
        path: '/welcome',
        name: 'welcome',
        component: welcome,
      },
      {
        path: '/system/station',
        name: 'station',
        component: station,
      },
      {
        path: '/system/train',
        name: 'train',
        component: train,
      },
      {
        path: '/system/train/station',
        name: 'trainStation',
        component: trainStation,
      },
      {
        path: '/system/carriage',
        name: 'trainCarriage',
        component: trainCarriage,
      },
      {
        path: '/system/seat',
        name: 'trainSeat',
        component: trainSeat,
      },
      {
        path: '/batch/job',
        name: 'job',
        component: job,
      },
      {
        path: '/about',
        name: 'about',
        component: about,
      },
      {
        path: '/daily/train',
        name: 'dailyTrain',
        component: dailyTrain
      },
      {
        path: '/daily/train/station',
        name: 'dailyTrainStation',
        component: dailyTrainStation
      },
      {
        path: '/daily/train/carriage',
        name: 'dailyTrainCarriage',
        component: dailyTrainCarriage
      },
      {
        path: '/daily/train/seat',
        name: 'dailyTrainSeat',
        component: dailyTrainSeat
      },
      {
        path: '/daily/train/ticket',
        name: 'dailyTrainTicket',
        component: dailyTrainTicket
      },
      {
        path: '/order/confirm',
        name: 'orderConfirm',
        component: orderConfirm
      },
      {
        path: '/ticket',
        name: 'ticket',
        component: ticket
      },
      {
        path: '/daily/train/token',
        name: 'dailyTrainToken',
        component: dailyTrainToken
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
